import java.util.HashMap;

class VarTable extends HashMap<String, Var>
{
   public void add(Var v) throws BabytalkRuntimeException
   {
      if (containsKey(v.getName()))
         throw new BabytalkRuntimeException("variable '" + v.getName() + "' already added");
      
      put(v.getName(), v);
   }

   public Var get(String name) throws BabytalkRuntimeException
   {
      if (!containsKey(name))
         throw new BabytalkRuntimeException("no " + name + " variable in table");
      return super.get(name);
   }
}
